package com.ihighest.app.infox.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class BusinessPagerAdapter extends PagerAdapter {
	Context context;
	List<View> imageviews;
	ArrayList<String> images;

	public BusinessPagerAdapter(Context context, ArrayList<String> images) {
		super();
		this.context = context;
		this.images = images;
		adddata();
	}

	private void adddata() {
		// TODO Auto-generated method stub
		imageviews = new ArrayList<View>();
		for (int i = 0; i < 5; i++) {
			ImageView imageView = new ImageView(context);
			imageviews.add(imageView);

		}

	}

	@Override
	public int getCount() {
		return 5;
	}

	@Override
	public boolean isViewFromObject(View arg0, Object arg1) {
		return arg0 == arg1;
	}

	@Override
	public Object instantiateItem(ViewGroup container, int position) {

		if (imageviews.get(position).getParent() != null) {
			container.removeView(imageviews.get(position));
		}

		container.addView(imageviews.get(position));
		return container;
	}

	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView(imageviews.get(position));
	}

}
